(function () {
    var Background = window.Background = function () {
        this.img = game.imgList.bg_day;
        this.x0 = 0;
        this.y0 = game.ctx.canvas.height * 0.75 - 400;
        this.index = 0;

    };
    //更新背景
    Background.prototype.update = function () {
        this.x0 -= 1;
        if(this.x0 <= -this.img.width){
            this.x0 = 0;
        }
    };
    //渲染背景
    Background.prototype.render = function () {
        game.ctx.drawImage(this.img, 0,0, this.img.width,this.img.height, this.x0,this.y0, this.img.width,this.img.height);
        game.ctx.drawImage(this.img, 0,0, this.img.width,this.img.height, this.x0+this.img.width,this.y0, this.img.width,this.img.height);
        game.ctx.drawImage(this.img, 0,0, this.img.width,this.img.height, this.x0+this.img.width*2,this.y0, this.img.width,this.img.height);
        game.ctx.fillStyle = "#4ec0ca";
        game.ctx.fillRect(0,0, game.ctx.canvas.width,this.y0+1);


    };
}());